<%@ page language="java" isELIgnored="false" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>单航线抓取统计——恒拓运价魔方</title>

<script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/show.js"></script>
<%-- <link href='<%=request.getContextPath()%>/fare/js/cityquery/cityquery.css' rel="stylesheet" type="text/css" />	 --%>
<link href="<%=request.getContextPath()%>/fare/css/base.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/fare/js/jquery-1.6.4.min.js"></script>
<link href="<%=request.getContextPath() %>/fare/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link rev="stylesheet" media="all" href="<%=request.getContextPath() %>/fare/css/form_style.css" type="text/css" rel="stylesheet">

<link href="<%=request.getContextPath() %>/fare/css/base.css" rel="stylesheet" type="text/css" />
<%-- <script type="text/javascript" src="<%=request.getContextPath() %>/fare/js/datePicker/WdatePicker.js"></script> --%>
<%-- <script type="text/javascript" src="<%=request.getContextPath() %>/fare/lib/ligerUI/js/ligerui.min.js"></script> --%>
<%-- <script src="<%=request.getContextPath() %>/fare/lib/ligerUI/js/plugins/ligerGrid.js" type="text/javascript"></script> --%>
<script	src="<%=request.getContextPath()%>/fare/lib/jquery/jquery.form.js"	type="text/javascript"></script>
<!-- 圆角文本框 -->
<link href="<%=request.getContextPath() %>/fare/css/htc/htc.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath() %>/fare/css/bt_class.css" rel="stylesheet" type="text/css"/>
<style type="text/css">
<style type="text/css">
.tooltips{
text-decoration:none;
position:relative;
z-index:2;
}
.tooltips:hover{
z-index:3;
background:none;
}
.tooltips span{
display: none;
}
.tooltips:hover span{
z-index:99999;
display:block;
position:absolute;  
margin:-20px -10px 0px -25px; border:0;
clear:both;
overflow:hidden;
margin:0;
padding:0;
border:1px solid black;
background-color:#DCDCDC;
padding:3px;
color:black;
}
</style>	
</style>
<script type="text/javascript">
$(document).ready(function(){
	//初始化航线组件
	$('#depCity').querycity({'data':citysFlight,'tabs':labelFromcity});
	$('#arrCity').querycity({'data':citysFlight,'tabs':labelFromcity});
	
	if($("#depCity").val()=="" || $("#depCity").val()=="中文/拼音" ){
		if('${depCity}' !=null && '${depCity}' !=""){
			$("#depCity").val('${depCityName}(${depCity})');
		}
		
	}
	if($("#arrCity").val() =="" || $("#arrCity").val() =="中文/拼音"){
		if('${arrCity}' !=null && '${arrCity}'!=""){
			$("#arrCity").val('${arrCityName}(${arrCity})');
		}
	}
	
	var table=$("#username");
	$(table).empty();
	 <c:forEach items="${singleLineCrawlStatisticsVOList}" var="vo" varStatus="status">	
		table.append("<tr style=''></tr>");
		$("tr:last",table).append("<input name='Reportgrabchannel' type='hidden' id='Reportgrabchannel_${status.index+1 }' value='${vo.grabChannel}' />");
		$("tr:last",table).append("<td >${vo.grabChannel}</td>");
		
		<c:forEach items="${vo.statusDataVoList}" var="vo2" varStatus="statusList">
		$("tr:last",table).append("<td style='text-align: center; cursor:pointer;'>"

		+"<input type='hidden' name='indexNumber' id='indexNumber' value='${statusList.index+1 }'/>"
		+"<input type='hidden' name='finishedStartTimeStr' id='finishedStartTime_${status.index+1}_${statusList.index+1 }' value='${vo2.startTimeStr}'/>"
		+"<input type='hidden' name='finishedEndTimeStr' id='finishedEndTime_${status.index+1}_${statusList.index+1 }' value='${vo2.finishedStartTimeStr}'/>"
		+"</td>");
		
		if('${vo2.status}'==1){
			$("td:last").append("<a class='tooltips' onclick='javascript:showFinishedData("+'"${status.index+1 }"'+","+'"${statusList.index+1 }"'+")' style='text-decoration:none'>"
			+"<font size='2.5pt' color='#0000FF'>${vo2.statusName}</font>"
			+"<span><font size='2' style='line-height:12pt;padding:33px 0 0;left:10px;top:10px'>开始时间：${vo2.startTimeStr}<br>结束时间：${vo2.finishedStartTimeStr}"
			+"</a>");
			
		}if('${vo2.status}'==2){
			$("td:last").append("<a class='tooltips' style='text-decoration:none'><font size='2.5pt' color='#0000FF'>${vo2.statusName}</font>"
			+"<span><font size='2' style='line-height:12pt;padding:33px 0 0;'>开始时间：${vo2.startTimeStr}<br>"
			+"</a>");
					
		}if('${vo2.status}'==3){
			$("td:last").append("<a class='tooltips' style='text-decoration:none'><font size='2.5pt' color='#0000FF'>${vo2.statusName}</font>"
			+"<span><font size='2' style='line-height:12pt;padding:33px 0 0;'>预测开始时间：<br/>${vo2.noBeginNextTimeStr}<br>"
			+"</a>");
			
		}

		</c:forEach>
		</c:forEach> 
});


function checkForm(){
var flag=true;
	
	if ($("#depCity").val() == ''||$("#arrCity").val() == '') {
		flag = false;
		alert("请设置正确的出发地和目的地");
		return;
	}    		
	if ($("#depCity").val() == '中文/拼音'||$("#arrCity").val() == '中文/拼音') {
		flag = false;
		alert("请设置正确的出发地和目的地");
		return;
	}
	if($("#depCity").val() ==$("#arrCity").val()){
		flag = false;
		alert("请设置正确的出发地和目的地");
	}
	return flag;
	
}

$(document).ready(function(){
	
	if($("#depCity").val() == ''||$("#arrCity").val() == ''){
		$("#depCity").val('${depCityName}');
		$("#arrCity").val('${arrCityName}');
	}
});

function find(){
	if(!checkForm()){
		return;
	}
	if ($("#depCity").val() == '中文/拼音'){
		$("#depCity").val("");
	}
	if ($("#arrCity").val() == '中文/拼音'){
		$("#arrCity").val("");
	}
	if((toCitys !="" && toCitys !="中文/拼音") ||( fromCitys !="" && fromCitys !="中文/拼音")){
		if($.trim($("#depCity").val())!="" 
				&& $.trim($("#arrCity").val())!="" 
				&& $.trim($("#depCity").val())==$.trim($("#arrCity").val())){
			alert("出发地和目的地不能相同");
			return;
		}
	}
	$("#lineForm").attr("action","<%=request.getContextPath()%>/crawlInfoAction!findSingleLine.action");
	$("#lineForm").submit();
}

//打开历史数据页面
function showHistoryData(v1,v2){
	var depCitys=v1;
	var arrCitys=v2;
	var url='<%=request.getContextPath() %>/crawlInfoAction!findHistoryData.action?depCity='+depCitys+'&arrCity='+arrCitys;
	//在当前窗口重新打开一个
	parent.f_addTab("crawl_history","历史数据", url);
}
//打开已经完成抓取页面
function showFinishedData(v1,v2){
	var statuIndex=v1;
	var statuListIndex=v2;
	var depCityName= encodeURI(encodeURI(document.getElementById("depCityName").value));
	var depCity= encodeURI(encodeURI(document.getElementById("depCitys").value));
	var arrCityName= encodeURI(encodeURI(document.getElementById("arrCityName").value));
	var arrCity= encodeURI(encodeURI(document.getElementById("arrCitys").value));
	var indexNumber=statuListIndex;// encodeURI(encodeURI(document.getElementById("indexNumber").value));
	var finishedStartTimeStr=encodeURI(encodeURI(document.getElementById('finishedStartTime_'+statuIndex+'_'+statuListIndex).value));
	var finishedEndTimeStr=encodeURI(encodeURI(document.getElementById('finishedEndTime_'+statuIndex+'_'+statuListIndex).value));
	var Reportgrabchannel=encodeURI(encodeURI(document.getElementById('Reportgrabchannel_'+statuIndex).value));
	var url='<%=request.getContextPath() %>/crawlInfoAction!finishedCrawlDataView.action?depCity='+depCity+'&arrCity='+arrCity+'&depCityName='+depCityName+'&arrCityName='+arrCityName+'&indexNumber='+indexNumber+'&finishedStartTimeStr='+finishedStartTimeStr+'&finishedEndTimeStr='+finishedEndTimeStr+'&Reportgrabchannel='+Reportgrabchannel;	
	parent.f_addTab("crawl_finished","已完成数据", url);	
}
//航线
function findByLine(){
	var toCitys=$("#arrCity").val();
	var fromCitys=$("#depCity").val();
	
	if(!checkForm()){
		return;
	} 
	if ($("#depCity").val() == '中文/拼音'){
		$("#depCity").val("");
	}
	if ($("#arrCity").val() == '中文/拼音'){
		$("#arrCity").val("");
	}
	if((toCitys !="" && toCitys !="中文/拼音") ||( fromCitys !="" && fromCitys !="中文/拼音")){
		if($.trim($("#depCity").val())!="" 
				&& $.trim($("#arrCity").val())!="" 
				&& $.trim($("#depCity").val())==$.trim($("#arrCity").val())){
			alert("出发地和目的地不能相同");
			return;
		}
	}
	var flag=1;
	$("#lineForm").attr("action","<%=request.getContextPath()%>/crawlInfoAction!findSingleLine.action?fromCitys="+fromCitys+"&toCitys="+toCitys+"&flag="+flag);
	$("#lineForm").submit();
}
function get_lastDate(ymd,ym,n){  
    ymd=ymd?new Date(ymd.replace(/-/g,"/")):new Date();  
    ym&&(ym=="y"?ymd.setFullYear(ymd.getFullYear()-1):ymd.setMonth(ymd.getMonth()-1));  
    n&&ymd.setDate(ymd.getDate()+n);  
    return ymd.toLocaleDateString().match(/\d+/g).join('-');  
}  


</script>
</head>

<body>
	<div class="form_body">
		<div class="main_max">
		
			<div class="form_table_tltle"  >单航线抓取统计</div>
			<form id="lineForm" action="" method="post">
				<table width="0" border="0" cellpadding="0" cellspacing="0" class="form_table">
					<tr> 
						<td width="380px"><jsp:include page="../../inc/flightSelect.jsp"></jsp:include>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<a href="#" name=""  class="css_btn_class"  onclick="findByLine()" style="margin-left:1px"/>查询
						</td>
					</tr>
				</table>
			</form>
			
			<div class="high_10"></div>
			
			<form action="" id="page_form">
				<table width="0" border="0" cellspacing="0" cellpadding="0" class="form_list">
					<tr >
						<input type="hidden" name="depCityName" id ="depCityName" value="${depCityName}" />
						<input type="hidden" name="depCitys" id="depCitys" value="${depCity}" />
						<input type="hidden" name="arrCityName" id="arrCityName" value="${arrCityName}" />
						<input type="hidden" name="arrCitys" id="arrCitys" value="${arrCity}" />
						<td  align="left" height="15px" style="font-size:20px ;border-right:none;" width="300px">${depCityName}(${depCity})——${arrCityName }(${arrCity})</td>
					</tr>
					<tr>
						<td style="border-right:none;"> ${grabdate }数据量：${sigleTotalSize }M</td>
						<td style="border-left:none;"> 
							<a onclick="javascript:showHistoryData('${depCity}','${arrCity}')" target="_blank" style="cursor:pointer">
								<font size="2.5pt" color="#0000FF" >历史数据</font>
							</a>
						</td>
					</tr>
					<tr>
						<td style="border-right:none;"> 抓取成率：${sigleSuccessRate }</td>
						<td style="border-left:none;"> 数据完整性：${sigleDataTotalRate }</td>
					</tr>
				</table>
			
			</form>
			
			<div class="high_10"></div>
			<form action="" id="page_form">
			<div class="form_table_tltle">
				<table>
					<tr>
					<td align="left" style="font-size:12px">航线抓取详情</td>
					</tr>
				</table>
			</div>
			<table width="0" border="0" cellspacing="0" cellpadding="0" class="form_list" id="username" >
				
			</table>
		
		
		</form>
			<div class="high_10"  style="height:40px;"></div>
		</div>
		
	</div>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
	<jsp:include page="../../inc/footer2.jsp"></jsp:include>
	<script type='text/javascript' src='<%=request.getContextPath()%>/fare/js/cityquery/querycity.js'></script>
</body>
</html>

